package 力扣;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: a
 * Date: 2022-09-30
 * Time: 8:30
 */
public class zero_matrix_lcci {
    public static void setZeroes(int[][] matrix) {
        int row = matrix.length;
        int col = matrix[0].length;
        int[][] q = new int[row][col];
        for(int i = 0; i < row; i++){
            for(int j = 0; j < col; j++){
                q[i][j] = matrix[i][j];
            }
        }
        for(int i = 0; i < row; i++){
            for(int j = 0; j < col; j++){
                if(q[i][j] == 0){
                    for(int k = 0; k < col; k++){
                        matrix[i][k] = 0;
                    }
                    for(int k = 0; k < row; k++){
                        matrix[k][j] = 0;
                    }
                }
            }
        }
    }

    public static void main(String[] args) {
        int[][] matrix = {{0,1,2,0},{3,4,5,2},{1,3,1,5}};
        setZeroes(matrix);
    }
}
